<template>
  <div class="main">
    <!-- 活动列表 -->
    <div class="activeTab">
      <van-tabs :active="active" :border="false" color="#187798" sticky>
        <van-tab title="全部">
          <div class="hotLit">
            <ul>
              <li
                v-for="(item,index) of newsList"
                class="onlyLi"
                :key="index"
                @click="()=>{goActiveDetail(item.id, item.status)}"
              >
                <div class="imgShow">
                  <img :src="item.coverImg" class="newsPic" />
                  <div class="activeStatus">
                    <img v-if="item.status === '未开始'" src="/static/images/index/unstart.png" alt />
                    <img v-if="item.status === '报名中'" src="/static/images/index/applying.png" alt />
                    <img v-if="item.status === '已结束'" src="/static/images/index/over.png" alt />
                    <span>{{item.status}}</span>
                  </div>
                </div>
                <div class="newsInfor">
                  <p>{{item.activeName}}</p>
                  <span>{{item.activeTime}}</span>
                </div>
              </li>
            </ul>
          </div>
        </van-tab>
        <van-tab title="未开始">
          <div class="hotLit">
            <ul>
              <li
                v-for="(item,index) of newsList"
                :key="index"
                @click="()=>{goActiveDetail(item.id, item.status)}"
              >
                <div class="li" v-if="item.status === '未开始'">
                  <div class="imgShow">
                    <img :src="item.coverImg" class="newsPic" />
                    <div class="activeStatus">
                      <img src="/static/images/index/unstart.png" alt />
                      <span>{{item.status}}</span>
                    </div>
                  </div>
                  <div class="newsInfor">
                    <p>{{item.activeName}}</p>
                    <span>{{item.activeTime}}</span>
                  </div>
                </div>
              </li>
            </ul>
          </div>
        </van-tab>
        <van-tab title="报名中">
          <div class="hotLit">
            <ul>
              <li
                v-for="(item,index) of newsList"
                :key="index"
                @click="()=>{goActiveDetail(item.id, item.status)}"
              >
                <div class="li" v-if="item.status === '报名中'">
                  <div class="imgShow">
                    <img :src="item.coverImg" class="newsPic" />
                    <div class="activeStatus">
                      <img src="/static/images/index/applying.png" alt />
                      <span>{{item.status}}</span>
                    </div>
                  </div>
                  <div class="newsInfor">
                    <p>{{item.activeName}}</p>
                    <span>{{item.activeTime}}</span>
                  </div>
                </div>
              </li>
            </ul>
          </div>
        </van-tab>
        <van-tab title="已结束">
          <div class="hotLit">
            <ul>
              <li
                v-for="(item,index) of newsList"
                :key="index"
                @click="()=>{goActiveDetail(item.id, item.status)}"
              >
                <div class="li" v-if="item.status === '已结束'">
                  <div class="imgShow">
                    <img :src="item.coverImg" class="newsPic" />
                    <div class="activeStatus">
                      <img src="/static/images/index/over.png" alt />
                      <span>{{item.status}}</span>
                    </div>
                  </div>
                  <div class="newsInfor">
                    <p>{{item.activeName}}</p>
                    <span>{{item.activeTime}}</span>
                  </div>
                </div>
              </li>
            </ul>
          </div>
        </van-tab>
        <div style="background: #f7f7f6ff;padding-bottom: 10px;">
          <div class="activeMore">—— 已经到底啦 ——</div>
        </div>
      </van-tabs>
    </div>
  </div>
</template>

<script>
export default {
  props: {},
  data () {
    return {
      currentIndex: 0,
      active: 0,
      // 活动列表
      newsList: [
        {
          id: 1,
          coverImg: '/static/images/index/hot1.png',
          activeName: '活动名称活动名称活动名称',
          activeTime: '报名日期：2019-06-06至2019-07-07',
          status: '未开始'
        },
        {
          id: 2,
          coverImg: '/static/images/index/hot2.png',
          activeName: '活动名称活动名称活动名称活动名称活动名称活动最多两行…',
          activeTime: '报名日期：2019-06-06至2019-07-07',
          status: '报名中'
        },
        {
          id: 3,
          coverImg: '/static/images/index/hot3.png',
          activeName: '活动名称活动名称活动名称',
          activeTime: '报名日期：2019-06-06至2019-07-07',
          status: '已结束'
        },
        {
          id: 4,
          coverImg: '/static/images/index/hot1.png',
          activeName: '活动名称活动名称活动名称活动名称活动名称活动最多两行…',
          activeTime: '报名日期：2019-06-06至2019-07-07',
          status: '未开始'
        },
        {
          id: 5,
          coverImg: '/static/images/index/hot2.png',
          activeName: '活动名称活动名称活动名称',
          activeTime: '报名日期：2019-06-06至2019-07-07',
          status: '报名中'
        }
      ]
    };
  },
  computed: {},
  created () {},
  mounted () {},
  watch: {},
  methods: {
    // 跳到活动详情
    goActiveDetail (id, status) {
      wx.navigateTo({
        url: `/pages/index/activeDetail/main?classifyId=${id}&status=${status}`
      });
    }
  },
  components: {}
};
</script>

<style scoped lang="less">
.main {
  background: #f7f7f6ff;
  // 活动版块
  .activeTab {
    padding-top: 15px;
    background: #fff;
  }
  .activeTab /deep/ .van-tab--active .van-ellipsis {
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFangSC;
    letter-spacing: 3px;
    font-weight: 700;
    line-height: 25px;
    color: rgba(24, 119, 152, 1);
  }
  .activeTab /deep/ .van-ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    letter-spacing: 3px;
    font-size: 13px;
    font-family: PingFangSC-Regular, PingFangSC;
    font-weight: 400;
    line-height: 25px;
    color: rgba(144, 146, 146, 1);
  }
  .activeTab /deep/ .van-tabs__line {
    bottom: 0;
    left: 12px;
    width: 26px !important;
    text-align: center !important;
    z-index: 1;
    height: 4px;
    background-color: #187798ff;
    border-radius: 3px;
  }
  .hotLit {
    padding: 0 15px;
    background-color: #fff;
    border-top: 1px solid #e6e6e6ff;
    border-bottom: 1px solid #e6e6e6ff;
    ul {
      padding-top: 16px;
      display: flex;
      flex-direction: column;
      li {
        background-color: #fff;
        display: flex;
        .imgShow {
          width: 90px;
          height: 90px;
          position: relative;
          margin-right: 15px;
          .newsPic {
            width: 100%;
            height: 100%;
          }
          .activeStatus {
            width: 51px;
            height: 20px;
            text-align: center;
            position: absolute;
            top: 0;
            left: 0;
            img {
              width: 100%;
              height: 100%;
              position: absolute;
              top: 0;
              left: 0;
            }
            span {
              font-size: 10px;
              font-family: PingFangSC-Medium, PingFangSC;
              font-weight: 700;
              color: rgba(255, 255, 255, 1);
              line-height: 14px;
              position: absolute;
              left: 6px;
              top: 3px;
            }
          }
        }
        .newsInfor {
          width: 240px;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          p {
            font-size: 15px;
            font-family: PingFangSC-Regular, PingFangSC;
            font-weight: 700;
            color: rgba(2, 6, 4, 1);
            line-height: 21px;
            -webkit-line-clamp: 2;
          }
          span {
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFangSC;
            font-weight: 400;
            color: rgba(144, 146, 146, 1);
            line-height: 17px;
          }
        }
      }
      .li {
        margin-bottom: 15px;
        background-color: #fff;
        display: flex;
      }
      .onlyLi {
        margin-bottom: 15px;
      }
    }
  }
  .activeMore {
    height: 18px;
    font-size: 13px;
    font-family: PingFangSC-Medium, PingFangSC;
    font-weight: 700;
    color: #b8bab9;
    line-height: 18px;
    text-align: center;
    height: 18px;
    padding-top: 5px;
  }
}
</style>
